﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace iDMS.Models
{
    [MetadataType(typeof(Sheet_Buddy))]
    public partial class Sheet
    {
        private string generateRevisionSymbol(int rev)
        {
            string result = "";
            if (rev == 0)
            {
                result = "-";
            }
            else
                if (rev < 25)
                {
                    result = Convert.ToString(Convert.ToChar(rev + 96));
                }

            return result;
        }

        public string RevisionSymbol
        {
            get
            {
                return generateRevisionSymbol(this.Revision);
            }
        }

        public string FileSize
        {
            get
            {
                if (Resource != null)
                {
                    return String.Format(new FileSizeFormatProvider(), "{0:fs}", Resource.FileData.Length);
                }
                else
                {
                    return "";
                }
            }
        }

    }

    public class Sheet_Buddy
    {
        [DataType(DataType.Date)]
        [Display(Name = "Date")]
        public DateTime CreateDate { get; set; }

        [Display(Name = "Page Number")]
        public int PageNmb { get; set; }

        [Display(Name = "Format")]
        public System.Nullable<int> FormatID { get; set; }

        [Display(Name = "Information Carrier")]
        public byte CarrierID { get; set; }

        [Display(Name = "Design Change")]
        public int DesignChangeID { get; set; }

        [Display(Name = "Innaplicable Design Change")]
        public System.Nullable<int> InnaplicableChangeID { get; set; }

        [Display(Name = "Creator")]
        public int EmployeeID { get; set; }

        [Display(Name = "Life Cycle Status")]
        public int LifeCycleStatusID { get; set; }

        [Display(Name = "is under Revision or Withdrawal")]
        public System.Nullable<bool> UnderRevisionWithdrawal { get; set; }


        /*
        [Required(ErrorMessage = "Name is required")]
        [StringLength(80, ErrorMessage = "The value cannot exceed 80 characters. ")]
        public string Name { get; set; }

        [Required(ErrorMessage = "Adress is required")]
        [StringLength(160, ErrorMessage = "The value cannot exceed 160 characters. ")]
        public string Adress { get; set; }

        [Required(ErrorMessage = "City is required")]
        [StringLength(50, ErrorMessage = "The value cannot exceed 50 characters. ")]
        public string City { get; set; }

        [Required(ErrorMessage = "PostCode is required")]
        [StringLength(20, ErrorMessage = "The value cannot exceed 20 characters. ")]
        public string PostCode { get; set; }
        */


    }
}